Class account(m)
   balance := m;
   
   withdraw := 
			proc (w) 
                ret := w;
				if w then 
					if balance - w then
						balance := balance - w
					else
						ret := balance;
						balance := 0
					fi
				else
					ret := 0
				fi;
				return := ret
			end;
	deposit := 
			proc (d)
				ret := d;
				if d then 
					balance := balance + d
				else
					ret := 0
				fi;
				return := ret
			end;
	getbalance := 
			proc (q) 
				return := balance
			end
end;

Class matchingaccount(m) : account
	deposit := 
			proc (dd)
				retd := dd;
				if dd then 
					balance := balance + (dd * 2)
				else
					retd := 0
				fi;
				return := retd
			end
end;

aone := account(50);
atwo := account(100);
athree := matchingaccount(200);
bathree := athree.getbalance(0);
dthree := athree.deposit(40);
bbthree := athree.getbalance(0);
wthree := athree.withdraw(60);
bcthree := athree.getbalance(0)
